import { Modal } from "antd";
import React from "react";
import PropTypes from "prop-types";
import SoftBox from "components/SoftBox";
import SoftTypography from "components/SoftTypography";

export default function CustomModal({ title, open, onCancel, children, width }) {
  return (
    <Modal
      title={
        <SoftBox display="flex" justifyContent="center">
          <SoftTypography variant="h5" fontWeight="bold">
            {title}
          </SoftTypography>
        </SoftBox>
      }
      footer={[]}
      maskClosable={true}
      closable={false}
      width={width}
      centered
      open={open}
      onCancel={onCancel}
      zIndex="9000"
    >
      {children}
    </Modal>
  );
}
CustomModal.defaultProps = {
  width: "462px",
};
CustomModal.propTypes = {
  title: PropTypes.string.isRequired,
  open: PropTypes.bool.isRequired,
  onCancel: PropTypes.func.isRequired,
  children: PropTypes.node.isRequired,
  width: PropTypes.string,
};
